<!--
 * @author dumeng
 自定义页面管理
 -->
<template>
  <div id="page-manage">
    <el-container class="custom-page-info">
      <split-pane split="vertical" :min-percent="0" :default-percent="24">
        <template slot="paneL">
          <div class="left-wrap-c">
            <div class="search-tree-wrap">
              <el-input v-model="searchName" style="width:70%" placeholder="输入关键字搜索" class="search-input" clearable @clear="clearSearchTree" />
              <el-button class="filter-item tree-filter" type="primary" @click="handleFilterTree">搜索</el-button>
            </div>
            <el-tree
              ref="fltree"
              v-loading="treeLoading"
              :data="classifyOptions"
              :props="defaultProps"
              :expand-on-click-node="false"
              highlight-current
              node-key="id"
              :filter-node-method="filterNode"
              @node-click="handleTreeClick"
            />
          </div>
        </template>
        <template slot="paneR">
          <el-main class="user-main">
            <el-collapse-transition>
              <div v-show="searchshow" class="course-search merge">
                <span class="svg-container">
                  <svg-icon icon-class="search" />
                </span>
                <el-input
                  v-model.trim="listQuery.commonParam"
                  placeholder="请输入关键字搜索"
                  class="search-input"
                  @keyup.enter.native="handleFilter"
                />
                <div class="course-search-btn">
                  <el-button
                    class="filter-item"
                    type="primary"
                    @click="handleFilter"
                  >搜索</el-button>
                  <el-button
                    class="filter-item"
                    type="primary"
                    @click="resettingBtn"
                  >重置</el-button>
                  <span class="course-search-more" @click="searchshow = !searchshow">
                    更多筛选条件
                    <i class="el-icon-arrow-down" />
                  </span>
                </div>
              </div>
            </el-collapse-transition>
            <el-collapse-transition>
              <div v-show="!searchshow" class="course-search separate">
                <div class="course-search-inner">
                  <el-row>
                    <el-col :span="12">
                      <div class="search-inner-item">
                        <div class="item-label">页面名称</div>
                        <el-input
                          v-model.trim="search.pageName"
                          style="width: 80%"
                          class="filter-item"
                          placeholder="请输入页面名称搜索"
                        />
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="search-inner-item">
                        <div class="item-label">页面标识</div>
                        <el-input
                          v-model.trim="search.pageCode"
                          style="width: 80%"
                          class="filter-item"
                          placeholder="请输入页面标识搜索"
                        />
                      </div>
                    </el-col>
                    <el-col :span="12">
                      <div class="search-inner-item">
                        <div class="item-label">路由名称</div>
                        <el-input
                          v-model.trim="search.pageRoute"
                          placeholder="请输入路由名称搜索"
                          class="search-input"
                          @keyup.enter.native="handleFilter"
                        />
                      </div>
                    </el-col>
                  </el-row>
                </div>
                <div class="course-search-btn">
                  <el-button
                    class="filter-item"
                    type="primary"
                    @click="handleFilter"
                  >搜索</el-button>
                  <el-button
                    class="filter-item"
                    type="primary"
                    @click="resettingBtn"
                  >重置</el-button>
                  <span class="course-search-more" @click="searchshow = !searchshow">
                    精简筛选条件
                    <i class="el-icon-arrow-up" />
                  </span>
                </div>
              </div>
            </el-collapse-transition>
            <div class="btn-container">
              <div class="btn-container-title">
                <span>自定义页面管理</span><span v-if="classifyName">，当前选择</span><span v-if="classifyName" class="btn-container-title-select">{{ classifyName }}</span>
              </div>
              <div class="btn-container-btns">
                <el-button
                  class="filter-item"
                  style="margin-left: 10px"
                  @click="handleCreate"
                >新建</el-button>
                <el-dropdown @command="handleExport">
                  <el-button style="margin-left: 10px">
                    导出<i class="el-icon-arrow-down el-icon--right" />
                  </el-button>
                  <el-dropdown-menu slot="dropdown">
                    <el-dropdown-item command="all">全部导出</el-dropdown-item>
                    <el-dropdown-item command="choose">仅导选中</el-dropdown-item>
                  </el-dropdown-menu>
                </el-dropdown>
                <el-button
                  style="margin-left: 10px"
                  @click="dialogUploadVisible=true"
                >导入</el-button>
              </div>
            </div>
            <div class="classify-tab">
              <el-tabs v-model="activeStatus" @tab-click="handleStatusClick">
                <el-tab-pane
                  v-for="item in statusOptions"
                  :key="item.id"
                  :label="item.name"
                  :name="item.id"
                />
              </el-tabs>
            </div>
            <section class="main-table">
              <v-table
                :list="list"
                :tag="activeStatus === '1' ? 'pageManageList' : 'pageManageLists'"
                :list-loading="listLoading"
                :selection="true"
                :filter-column="filtercolumn"
                @handleSelectionChange="handleSelectionChange"
              >
                <el-table-column
                  label="操作"
                  fixed="right"
                  align="center"
                  min-width="100"
                  class-name="small-padding fixed-width"
                >
                  <template slot-scope="scope">
                    <el-button
                      type="text"
                      size="mini"
                      @click="view(scope.row)"
                    >预览</el-button>
                    <el-button
                      v-if="activeStatus == 2"
                      type="text"
                      size="mini"
                      @click="handlePublish(scope.row)"
                    >发布
                    </el-button>
                    <el-button
                      v-if="activeStatus == 2"
                      type="text"
                      size="mini"
                      @click="handleUpdate(scope.row)"
                    >编辑</el-button>
                    <el-button
                      v-if="activeStatus == 2"
                      type="text"
                      size="mini"
                      @click="handleConfig(scope.row)"
                    >配置</el-button>
                    <el-button
                      v-if="activeStatus == 2"
                      type="text"
                      size="mini"
                      @click="handleVersion(scope.row)"
                    >版本</el-button>
                    <el-button
                      v-if="activeStatus == 2"
                      type="text"
                      size="mini"
                      @click="handleDelete(scope.row)"
                    >删除</el-button>
                    <el-button
                      v-if="activeStatus == 1"
                      type="text"
                      size="mini"
                      @click="handleDelete(scope.row)"
                    >取消发布</el-button>
                  </template>
                </el-table-column>
              </v-table>
              <pagination
                v-show="total > 0"
                :total="total"
                :page.sync="listQuery.page"
                :limit.sync="listQuery.limit"
                @pagination="getList"
              />
            </section>
          </el-main>
        </template>
      </split-pane>
    </el-container>
    <el-dialog
      v-el-drag-dialog
      :close-on-click-modal="false"
      title="选择生效时间"
      :visible.sync="publishVisible"
      center
      width="450px"
    >
      <el-date-picker
        v-model="effectTime"
        style="width: 100%"
        type="datetime"
        format="yyyy-MM-dd HH:mm:ss"
        value-format="yyyy-MM-dd HH:mm:ss"
        placeholder="请选择"
      />
      <div slot="footer" class="dialog-footer">
        <el-button
          style="padding: 8px 30px"
          @click="publishVisible = false"
        >取消</el-button>
        <el-button
          style="padding: 8px 30px"
          type="primary"
          @click="publish"
        >确定</el-button>
      </div>
    </el-dialog>

    <el-dialog
      v-el-drag-dialog
      :close-on-click-modal="false"
      title="选择生效时间"
      :visible.sync="publishVisibles"
      center
      width="450px"
    >
      <el-date-picker
        v-model="effectTimes"
        style="width: 100%"
        type="datetime"
        format="yyyy-MM-dd HH:mm:ss"
        value-format="yyyy-MM-dd HH:mm:ss"
        placeholder="请选择"
      />
      <div slot="footer" class="dialog-footer">
        <el-button
          style="padding: 8px 30px"
          @click="publishVisibles = false"
        >取消</el-button>
        <el-button
          style="padding: 8px 30px"
          type="primary"
          @click="publishs"
        >确定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      :close-on-click-modal="false"
      :visible.sync="visible4init"
      title="设置初始值"
      center
      :before-close="
        () => {
          visible4init = false;
        }
      "
    >
      <el-form ref="form" :model="varForm" label-width="140px">
        <el-form-item v-for="(item, index) in varList" :key="item + index" :label="varList[index].name">
          <el-input v-model="varForm[item.code]" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button
          style="padding: 8px 30px"
          @click="visible4init = false"
        >关 闭</el-button>
        <el-button
          type="primary"
          style="padding: 8px 30px"
          @click="handleVarSubmit"
        >确 定</el-button>
      </div>
    </el-dialog>
    <!--导入-->
    <el-dialog v-el-drag-dialog :close-on-click-modal="false" :visible.sync="dialogUploadVisible" title="导入页面" center width="500px" @close="handleClosed">
      <el-upload
        ref="upload"
        v-loading="loadingUpload"
        element-loading-text="正在上传请稍后"
        element-loading-spinner="el-icon-loading"
        element-loading-background="rgba(0, 0, 0, 0.8)"
        :auto-upload="false"
        :on-success="uploadSuccess"
        :on-error="uploadError"
        :action="uploadaction"
        :headers="uploadHeaders"
        :data="uploadData"
        accept=".xls, .xlsx"
        class="upload-demo"
        drag
      >
        <i class="el-icon-upload" />
        <div class="el-upload__text">
          将文件拖到此处，或
          <em>点击上传</em>
        </div>
        <div slot="tip" class="el-upload__tip" style="text-align: right">
          只能上传.xls,.xlsx
        </div>
      </el-upload>
      <span slot="footer" class="dialog-footer">
        <el-button style="padding: 8px 30px;" type="primary" @click="handleClosed">取消</el-button>
        <el-button style="padding: 8px 30px;" type="primary" @click="submitUpload()">确认</el-button>
      </span>
    </el-dialog>
    <!-- 导入的错误信息  -->
    <el-dialog v-el-drag-dialog :close-on-click-modal="false" :visible.sync="dialogUploadErrorTextVisible" title="错误信息" center width="500px">
      <div class="error-text" style="height: 600px;overflow-y: auto">
        <el-row>
          <el-col v-for="(item, index) in uploadErrorList" :key="index" :span="24" style="margin-bottom: 10px;">{{ index + 1 }}、{{ item }}</el-col>
        </el-row>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button style="padding: 8px 30px;" type="primary" @click="dialogUploadErrorTextVisible = false">关闭</el-button>
        <el-button style="padding: 8px 30px;" type="primary" @click="copyErrorText()">复制</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import {
  queryPage,
  del,
  dels,
  publish,
  unPublishs,
  getDictByCode
} from '../api/index'
import VTable from '@/components/Table'
import Pagination from '@/components/Pagination'
import permission from '@/directive/permission/index.js' // 权限判断指令
// eslint-disable-next-line no-unused-vars
import elDragDialog from '@/directive/el-drag-dialog'
import { fetchList } from '@/views/pagemanage/api/category'
import splitPane from 'vue-splitpane'
import { exportSign, importSign } from '@/utils/fileImportOrExportSign'
import { maskAPI } from '../api/index'

export default {
  name: 'PageIndex',
  components: { VTable, splitPane, Pagination },
  directives: { permission, elDragDialog },
  data() {
    return {
      listQuery: {
        userId: -1,
        commonParam: '',
        page: 1,
        pageSize: 10
      },
      searchshow: true,
      search: {
        pageName: '',
        pageCode: '',
        pageRoute: ''
      },
      searchName: '',
      classifyOptions: [],
      defaultProps: {
        children: 'children',
        label: 'classifyName'
      },
      treeLoading: false,
      statusOptions: [
        {
          name: '编辑中',
          id: '2'
        },
        {
          name: '已发布',
          id: '1'
        }
      ],
      activeStatus: '2',
      activeTab: '',
      classifyName: '',
      list: [],
      total: 0,
      multipleSelection: [],
      listLoading: false,
      currentId: '',
      currentIds: '',
      publishVisible: false,
      publishVisibles: false,
      pickerOptions: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 24 * 60 * 60 * 1000
        }
      },
      effectTime: '',
      effectTimes: '',
      curPreview: {},
      ZDYYMBL: [],
      varList: [],
      visible4init: false,
      varForm: {},
      dialogUploadVisible: false,
      loadingUpload: false,
      uploadData: {
        pageType: ''
      },
      uploadaction: '/API-ENTERPRISE-BACKEND/backend/pageContainerInfo/importPageModel',
      uploadHeaders: { ttsxbwqm: '', ttsxsjzc: '', ttsxyhcs: '' },
      dialogUploadErrorTextVisible: false,
      uploadErrorList: []
    }
  },
  created() {
    this.getClassifyOption()
  },
  methods: {
    /**
     * 复制错误消息
     */
    copyErrorText() {
      let val = ''
      this.uploadErrorList.forEach(item => {
        val += item + '\n'
      })
      const input = document.createElement('input')
      input.setAttribute('readonly', 'readonly')
      input.setAttribute('value', val)
      document.body.appendChild(input)
      input.select()
      if (document.execCommand('copy')) {
        document.execCommand('copy')
        this.$message({
          title: '成功',
          message: '复制成功！',
          type: 'success',
          duration: 1500
        })
      }
      document.body.removeChild(input)
    },
    submitUpload() {
      if (this.$refs['upload'].uploadFiles.length === 0) {
        this.$message.error('请上传文件')
      } else {
        this.loadingUpload = true
        this.uploadData.pageType = this.activeTab
        this.uploadHeaders = importSign({}, { pageType: this.activeTab })
        setTimeout(() => {
          this.$refs.upload.submit()
        }, 1000)
      }
    },

    handleImport() {
      this.dialogUploadVisible = true
    },
    handleUploadQues() {
      this.dialogUploadVisible = true
    },
    uploadSuccess(data) {
      this.loadingUpload = false
      if (data.code === '200') {
        this.$message({
          message: '导入成功',
          type: 'success'
        })
        this.dialogUploadVisible = false
        this.uploadQuesDialogVisible = false
        this.$refs.upload.clearFiles()
        this.getList()
      } else {
        this.$message.error(data.msg || '网络异常')
        if (data.data.fileid) {
          const link = document.createElement('a')
          link.style.display = 'none'
          link.href = '/API-ENTERPRISE-BACKEND/backend/rushPass/downloadCheckFile' + exportSign({ errorId: data.data.fileid }).paramStr
          link.setAttribute('download', '页面.xlsx')
          link.setAttribute('target', '_blank')
          document.body.appendChild(link)
          link.click()
          document.body.removeChild(link)
        }
        this.$refs.upload.clearFiles()
        if (data.data) {
          this.uploadErrorList = data.data
          this.dialogUploadErrorTextVisible = true
        }
      }
    },
    uploadError(err) {
      this.loadingUpload = false
      this.$message.error(err || '网络异常')
    },
    handleClosed() {
      this.dialogUploadVisible = false
      this.loadingUpload = false
      this.$refs.upload.clearFiles()
    },
    /**
     * 导出
     */
    handleExport(c) {
      const obj = {
        pageType: this.activeTab
      }
      if (c === 'choose') {
        if (this.multipleSelection.length === 0) {
          this.$message.error('请选择要导出的数据!')
          return
        }
        obj.id = this.multipleSelection.map(i => { return i.id }).join(',')
      }
      const query = exportSign(obj).obj
      const loadingInstance = this.$loading({
        lock: true,
        text: '请稍后',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      })
      maskAPI(query).then(res => {
        const content = res.data
        const blob = new Blob([content])
        const fileName = '页面信息.xlsx'
        if ('download' in document.createElement('a')) {
          // 非IE下载
          const elink = document.createElement('a')
          elink.download = fileName
          elink.style.display = 'none'
          elink.href = URL.createObjectURL(blob)
          document.body.appendChild(elink)
          elink.click()
          URL.revokeObjectURL(elink.href) // 释放URL 对象
          document.body.removeChild(elink)
        } else {
          // IE10+下载
          navigator.msSaveBlob(blob, fileName)
        }
        loadingInstance.close()
      }).catch(err => {
        loadingInstance.close()
      })
    },
    /**
     * 字典树点击
     */
    handleTreeClick(data) {
      this.activeTab = data.id
      this.classifyName = data.classifyName
      this.getList()
    },

    /**
     * 清空搜索
     */
    clearSearchTree() {
      this.searchName = ''
      this.$refs.fltree.filter('')
    },

    /**
     * 按名称查询
     */
    handleFilterTree() {
      this.$refs.fltree.filter(this.searchName)
    },

    filterNode(value, data) {
      if (!value) return true
      return data.classifyName.indexOf(value) !== -1
    },
    // 获取字典
    getDict() {
      return new Promise((resolve, reject) => {
        const loading = this.$loading({
          lock: true,
          text: '请稍后',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.3)'
        })
        getDictByCode('ZDYYMBL')
          .then((res) => {
            loading.close()
            this.ZDYYMBL =
              res.data.data && res.data.data.length > 0
                ? res.data.data[0].list
                : []
            resolve()
          })
          .catch((error) => {
            loading.close()
            reject(error)
          })
      })
    },
    getVarLabel(value) {
      const target = this.ZDYYMBL.find((item) => {
        return item.dictValue === value
      })
      return Object.keys(target).length ? target.dictName : ''
    },
    async view(item) {
      if (!item.config) {
        this.$message({
          message: '页面配置为空',
          type: 'warning'
        })
        return
      }
      try {
        this.curPreview = JSON.parse(item.config)
      } catch (err) {
        this.$message({
          message: '页面配置有误，请重新配置。',
          type: 'warning'
        })
        return
      }
      this.varList = this.curPreview.pageVar || []
      if (this.varList.length) {
        this.varList.forEach(item => {
          this.$set(this.varForm, item.code, item.value)
        })
        this.visible4init = true
      } else {
        this.preview()
      }
    },
    handleVarSubmit() {
    /*  if (
        Object.values(this.varForm).some((item) => {
          return item
        })
      ) {
        this.visible4init = false
        this.preview()
      } else {
        this.$message({
          message: '初始信息不能为空',
          type: 'warning'
        })
      }*/
      this.visible4init = false
      this.preview()
    },
    async preview() {
      const { default: DialogView } = await import(
        '@/components/CustomPage/pagemaker/view'
      )
      this.$modal.show(
        DialogView,
        {
          title: '预览',
          inner: this.curPreview,
          varInfo: this.varForm,
          fn: this.handleComit,
          isInitData: true
        },
        {
          width: 375,
          height: 'auto',
          clickToClose: false,
          draggable: true
        }
      )
    },
    /**
     * 获取分类
     */
    getClassifyOption() {
      const loading = this.$loading({
        lock: true,
        text: '请稍后',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.3)'
      })
      this.treeLoading = true
      return new Promise((resolve, reject) => {
        fetchList({ classifyType: 'FLLX_CUSTOMPAGE' })
          .then(({ data }) => {
            this.treeLoading = false
            loading.close()
            this.classifyOptions = data.data || []
            this.activeTab = this.$route.query.c || data.data[0].id
            this.classifyName = this.classifyOptions.filter(item => { return item.id === this.activeTab })[0].classifyName
            this.$nextTick(() => {
              this.$refs['fltree'].setCurrentKey(this.activeTab)
            })
            this.getList()
          })
          .catch((error) => {
            this.treeLoading = false
            loading.close()
            reject(error)
          })
      })
    },
    /**
     * 分类选项卡切换
     */
    handleTabClick() {
      this.listQuery.page = 1
      this.getList()
    },
    /**
     * 页面状态tab切换
     */
    handleStatusClick() {
      this.listQuery.page = 1
      this.getList()
    },
    filtercolumn(scope, item) {
      if (item === 'isKeepAlive') {
        return scope.row[item] === '0' ? '是' : '否'
      } else {
        return scope.row[item]
      }
    },
    getList(obj) {
      var query = {
        page: obj ? obj.page : this.listQuery.page,
        pageSize: obj ? obj.limit : this.listQuery.pageSize,
        pageType: this.activeTab,
        activeStatus: this.activeStatus
      }
      if (this.searchshow) {
        query['commonParam'] = this.listQuery.commonParam
      } else {
        query['pageName'] = this.search.pageName
        query['pageCode'] = this.search.pageCode
        query['pageRoute'] = this.search.pageRoute
      }
      this.listLoading = true
      return new Promise((resolve, reject) => {
        queryPage(query)
          .then((res) => {
            this.listLoading = false
            // this.list = res.data.data || []
            this.list = res.data.data.rows || []
            this.total = res.data.data.total
          })
          .catch((error) => {
            reject(error)
            this.listLoading = false
          })
      })
    },
    handleFilter() {
      this.listQuery.page = 1
      this.getList()
    },
    resettingBtn() {
      this.listQuery.page = 1
      this.listQuery.pageSize = 10
      this.listQuery.commonParam = ''
      for (const key in this.search) {
        this.search[key] = ''
      }
      this.getList()
    },
    /**
     * 发布/取消发布
     */
    handlePublish(row) {
      if (row.issueState && row.issueState === 'GIPSTSTUS01') {
        this.$confirm('确认取消发布？', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          const loading = this.$loading({
            lock: true,
            text: '请稍后',
            spinner: 'el-icon-loading',
            background: 'rgba(0, 0, 0, 0.3)'
          })
          unPublishs({ id: row.id, issueState: 'GIPSTSTUS02' })
            .then((res) => {
              if (res.data.code === '200') {
                loading.close()
                this.$message({
                  type: 'success',
                  message: '操作成功!'
                })
                this.getList()
              }
            })
            .catch(() => {
              loading.close()
            })
        })
      } else if (row.issueState && row.issueState === 'GIPSTSTUS02') {
        this.currentIds = row.id
        this.publishVisibles = true
      } else {
        this.currentId = row.id
        this.publishVisible = true
      }
    },
    /**
     * 选择生效时间后发布
     */
    publishs() {
      this.$confirm('确认发布？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        unPublishs({
          id: this.currentIds,
          effectTime: this.effectTimes,
          issueState: 'GIPSTSTUS01'
        })
          .then((res) => {
            const loading = this.$loading({
              lock: true,
              text: '请稍后',
              spinner: 'el-icon-loading',
              background: 'rgba(0, 0, 0, 0.3)'
            })
            if (res.data.code === '200') {
              loading.close()
              this.$message({
                type: 'success',
                message: '操作成功!'
              })
              this.currentIds = null
              this.publishVisibles = false
              this.getList()
            }
          })
          .catch(() => {
            loading.close()
          })
      })
    },
    /**
     * 选择生效时间后发布
     */
    publish() {
      this.$confirm('确认发布？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          const loading = this.$loading({
            lock: true,
            text: '请稍后',
            spinner: 'el-icon-loading',
            background: 'rgba(0, 0, 0, 0.3)'
          })
          publish({ id: this.currentId, effectTime: this.effectTime })
            .then((res) => {
              if (res.data.code === '200') {
                loading.close()
                this.$message({
                  type: 'success',
                  message: '操作成功!'
                })
                this.currentId = null
                this.publishVisible = false
                this.getList()
              } else {
                loading.close()
              }
            })
            .catch(() => {
              loading.close()
            })
        })
        .catch(() => {})
    },
    handleConfig(row) {
      this.$router.push(`/pagemanage/config?i=${row.id}`)
    },
    handleCreate() {
      this.$router.push(`/pagemanage/manage?t=c`)
    },
    handleUpdate(row) {
      this.$router.push(`/pagemanage/manage?t=u&i=${row.id}`)
    },
    handleDeletes() {
      const arr = []
      if (this.multipleSelection.length > 0) {
        this.multipleSelection.forEach((item) => {
          arr.push(item.id)
        })
        const ids = arr.join(',')
        this.deleteUser(ids)
      } else {
        this.$message({
          message: '请选择需要删除的数据！',
          type: 'warning'
        })
      }
    },
    handleVersion(row) {
      this.$router.push(`/pagemanage/version?i=${row.id}`)
    },
    handleDelete(row) {
      if (this.activeStatus == 1) {
        this.deleteUsers(row.id)
      } else {
        this.deleteUser(row.id)
      }
    },
    deleteUsers(ids) {
      this.$confirm('此操作将取消发布, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          const loading = this.$loading({
            lock: true,
            text: '请稍后',
            spinner: 'el-icon-loading',
            background: 'rgba(0, 0, 0, 0.3)'
          })
          dels({ id: ids })
            .then((res) => {
              this.$message.success('成功!')
              loading.close()
              this.getList()
            })
            .catch(() => {
              loading.close()
            })
        })
        .catch(() => {})
    },
    deleteUser(ids) {
      this.$confirm('此操作将永久删除, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        const loading = this.$loading({
          lock: true,
          text: '请稍后',
          spinner: 'el-icon-loading',
          background: 'rgba(0, 0, 0, 0.3)'
        })
        del({ id: ids })
          .then((res) => {
            console.log(res)
            if (res.data.code == '200') {
              this.$message.success('删除成功!')
              loading.close()
              this.getList()
            } else {
              loading.close()
            }
          })
          .catch(() => {
            loading.close()
          })
      })
    },
    handleSelectionChange(arr) {
      this.multipleSelection = arr
    }
  }
}
</script>
<style lang="scss">
.form-view .content{
  padding: 0 !important;
}
.header{
  display: none !important;
}
.upload-demo{
  .el-upload-dragger{
    width: 100%;
  }
  display: flex;
  flex-direction: column;
  justify-content: center;
}
</style>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" type="text/scss">
$dark_gray: #bfced6;
// $mainColor: #18a5fd;
#page-manage {
  padding: 10px 20px 10px 10px;
  .custom-page-info {
    height: calc(100vh - 122px);
    padding: 0px;
    overflow: hidden;
    .vue-splitter-container{
      width: 100%;
      overflow: hidden;
    }
    .left-wrap-c {
      background: #fff;
      margin-right: 10px;
      padding: 10px;
      height: 100%;
      overflow-y: auto;
      .search-tree-wrap {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        .tree-filter {
          padding: 10px 18px;
        }
      }
    }
    .user-main {
      padding: 10px;
      position: relative;
      background-color: #fff;
      height: 100%;
      overflow-y: auto;
      .course-search {
        background-color: #fff;
        padding: 0 10px;
        .svg-container {
          padding: 0 5px 0 10px;
          color: $dark_gray;
          vertical-align: middle;
          display: inline-block;
          &_login {
            font-size: 20px;
          }
        }
        .search-input {
          width: 50%;
          position: relative;
          &:after {
            content: "";
            position: absolute;
            left: -25px;
            right: 0;
            bottom: 8px;
            height: 1px;
            background: rgba(226, 227, 232, 1);
          }
          input {
            outline: none;
            background: transparent;
            border: none;
            outline: medium;
            padding: 0;
            &:focus {
              outline: none;
              background-color: transparent;
            }
          }
        }

        .course-search-btn {
          display: inline-block;
          float: right;
          .el-button.is-round {
            padding: 10px 30px;
            margin-right: 34px;
          }
          .course-search-more {
            font-size: 14px;
            font-weight: 500;
            @include font-color($mainColor);
            cursor: pointer;
            margin-left: 10px;
          }
        }
        &.merge {
          height: 50px;
          line-height: 50px;
        }
        &.separate {
          .course-search-inner {
            padding-top: 10px;
            .search-inner-item {
              .item-label {
                height: 30px;
                line-height: 30px;
                font-size: 14px;
                color: #a6a6a6;
                font-weight: 400;
              }
              .el-input {
                position: relative;
                .el-input__inner {
                  border: none;
                  padding: 0;
                }
                &:after {
                  content: "";
                  height: 1px;
                  background-color: #e2e3e8;
                  position: absolute;
                  left: 0;
                  right: 0;
                  bottom: 0;
                }
              }
            }
          }
          .course-search-btn {
            text-align: center;
            display: block;
            float: none;
            height: 56px;
            line-height: 56px;
          }
        }
      }

      .btn-container {
        display: flex;
        align-items: center;
        margin-top: 5px;
        margin-bottom: 5px;
        .btn-container-title {
          flex: 1;
          height: 36px;
          line-height: 36px;
          font-size: 16px;
          font-weight: bold;
          color: rgba(51, 51, 51, 1);
          .btn-container-title-select {
            @include font-color($mainColor);
          }
        }
      }
      .classify-tab {
        width: 100%;
        margin: 10px 0;
        padding: 0 10px;
        background-color: #fff;
        display: flex;
        border-radius: 4px;
        .el-tabs__nav-wrap::after {
          display: none;
        }
        .el-tabs__header {
          margin: 0;
        }
      }
    }
  }

}
</style>
